package com.tool.configuration.common;

/**
 * @author 酒徒
 * @Version 1.0
 * @data 2024/1/23 17:32
 * 动态存取--随时存取id
 * 用法：登录时，设置id(setCurrentId)，退出时，注销id(removeCurrentId)
 */
public class BaseContext {
    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    public static Long getCurrentId() {
        return threadLocal.get();
    }

    public static void removeCurrentId() {
        threadLocal.remove();
    }


}
